<extend name='Public/demo' />

<block name='contents'>
	<div class="row">
		<aside class="profile-nav col-lg-3">
			<section class="panel">
				<div class="user-heading round">
					<a href="{:U('User/index')}">
						<!-- <img data-src="holder.js/112x112/auto/vine"  class="img-circle">
						-->
						<img src="__PUBLIC__/{$res.photo}"  class="img-circle"></a>
					<h1>
						{$res.nickname} <sup style="font-size:10px;"></sup>
					</h1>
					<p>{$Think.session.home.uname}</p>
				</div>
				<!-- </div> -->
				<ul class="nav nav-pills nav-stacked">
				<li class="active">
					<a href="{:U('User/index')}"> <i class="icon-user"></i>
						个人简介
					</a>
				</li>
				<li>
					<a href="{:U('User/myPage')}"> <i class="icon-file-alt"></i>
						个人主页
					</a>
				</li>
				<li>
					<a href="{:U('Image/index')}">
						<i class="icon-calendar"></i>
						我的相册
					</a>
				</li>
				<li>
				<a href="{:U('Friend/index')}">
					<i class="icon-female"></i>
					我的好友
				</a>
				</li>

				</ul>
			</section>
		</aside>
		<style>
			.pug{
				padding:5px;
				/*height:100px;*/
				background-color: #fff;
				border-radius: 8px;
			}
			.pug li{
				margin:5px;
				margin-bottom: 20px;
				float: left;
			}
			.pug li a{
				display:block;
				width:60px;
				height:60px;
				border: 2px solid #eee;
				border-radius: 50%;
				background-color:white;
				background-size:cover;
				background-position: center;
				line-height: 135px;
				text-align: center;
			}
			.clear{
				clear:both;
			}
		</style>
		<aside class="profile-info col-lg-9">
			<section class="panel">
				<label class="label label-success" style="margin-left:-10px">最近访客</label>
				<ul class="pug">
					<foreach name="pugList" item="v">
						<li><a href="{:U('Home/Visitors/index',array('id'=>$v['user_id']))}" target="_blank" title="{$v.nickname} - {:date('Y-m-d H:i:s',$v['time'])}" style="background-image:url(__PUBLIC__{$v.photo})">{$v.nickname}</a></li>
					</foreach>
					<div class="clear"></div>
				</ul>
			</section>
			<section class="panel">
				<div class="bio-graph-heading">当前经验值 :
				<span class="expnum">{$res.exp}</span>
				点  /  当前等级 :
				<span class="grade">{$grade}</span>
				级
				<?php echo  $res['sign'] + 24*3600 < time() ? '<button class="sign btn btn-info" style="background:#344860">签到</button>
			' : '' ;  ?>
				</div>
				<div class="panel-body bio-graph-info">
					<!-- <h1>用户名</h1> -->
					<div class="row">
						<div class="bio-row">
							<p>
								<span>姓名</span>
								: {$res.nickname}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>年龄</span>
								: {$res.age}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>性别</span>
								:
								<if condition="$res['sex'] eq 0">
									女
									<elseif condition="$res['sex'] eq 1" />
									男
									<else />
									保密
								</if>
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>生日</span>
								: {$res.birthday}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>ID</span>
								: {$res.user_id}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>邮箱</span>
								: {$Think.session.home.uname}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>注册时间</span>
								: {$u_res.regtime|date="Y-m-d",###}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>注册IP</span>
								: {$u_res.regip}
							</p>
						</div>
						<div class="bio-row">
							<p>
								<span>上次登录时间</span>
								:
								<if condition="empty($u_res['lasttime'])">/</p>
								<else />
								{$u_res.lasttime|date="Y-m-d h:i:s",###}
							</p>
						</if>
					</div>
					<div class="bio-row">
						<p>
							<span>上次登录IP</span>
							:
							<if condition="empty($u_res['lastip'])">
								/
								<else />
								{$u_res.lastip}
							</if>
						</p>
					</div>
					<div class="bio-row">
						<p>
							<span>标签</span>
							:
							<if condition="empty($res['tag'])">
								/
								<else />
								{$res.tag}
							</if>
						</p>
					</div>
					<div class="bio-row">
						<p>
							<span>地址</span>
							: {$res.area}
						</p>
					</div>
					<div class="bio-row" style="width:780px" >
						<p style="">
							<span>个性签名</span>
							:
							<span style="width:600px;word-wrap:break-word">{$res.signature}</span>
						</p>
						<!-- <p style="display:inline-block;width:600px">
						<span>个性签名</span>
						:
						<span style="display:inline-block;word-wrap:break-word;">{$res.signature}</span>
					</p>
					-->
				</div>
			</div>
		</div>
	</section>
</aside>

</div>
	<script type="text/javascript">
	  $('.sign').click(function(){
	      //得到当前的元素对象
	      $th = $(this);
	      //得到当前expnum的值
	      var expnum = $('.expnum').html();
	      $.post("{:U('User/ajaxexp')}",{},function(data){
	        if (data != 'no') {
	         $('.expnum').html( parseInt( expnum ) + parseInt( data ) );
	         $('.grade').html( parseInt( Math.sqrt( parseInt( expnum ) + parseInt( data ) ) ) );
	         $th.html('恭喜签到成功~24小时后才能再签到哦~').animate({'opacity':'0'},1500,function(){$(this).remove();});
	        }
	      });
	  });
	</script>
</block>
